<?php

namespace App\Providers;

use App\Models\Goods;
use App\Observers\GoodsObserver;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
//        如果你是在版本低于 5.7.7 的 MySQL release 上创建索引，那就需要你手动配置迁移生成的默认字符串长度
        \Schema::defaultStringLength(191);

        Goods::observe(GoodsObserver::class);
        //可以在这里设置所有视图共享的数据
        \View::share('site_title','吃货大本营');
        \View::share('site_description','吃出新境界,吃出新世界');
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        if ($this->app->environment() !== 'production') {
            $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
        }
    }
}
